package com.bbx.taxi.client.Util;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.DisplayMetrics;

import com.bbx.androidapi.util.DensityUtil;
import com.bbx.taxi.client.widget.StatusBar.StatusBar;
import com.bbx.taxi.official.R;

/**
 * Created by YANXUWEN on 2016/3/18.
 */
public class BackgroundUtils {
    public static Bitmap createBackground(Context context){
        DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        int width=metrics.widthPixels;
        int height=metrics.heightPixels;
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(context.getResources().getColor(R.color.background));
        Paint p=new Paint();
        p.setColor(context.getResources().getColor(R.color.btn_nor));
        canvas.drawRect(0,0,width,DensityUtil.dip2px(context,50)+ StatusBar.getStatusHeight(context),p);
        return bitmap;
    }
    public static Bitmap createMenuBackground(Context context){
        DisplayMetrics metrics = context.getResources().getDisplayMetrics();
        int width=metrics.widthPixels;
        int height=metrics.heightPixels;
        Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.drawColor(context.getResources().getColor(R.color.white));
        Paint p=new Paint();
        p.setColor(context.getResources().getColor(R.color.white));
        canvas.drawRect(0,0,width,DensityUtil.dip2px(context,50)+ StatusBar.getStatusHeight(context),p);
        return bitmap;
    }
}
